package com.example.demo.Service;

import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;
import java.io.IOException;

@Service
public class ScheduledTasks {

    /**
     * 每天凌晨1点更新数据
     * @throws IOException
     */
    @Scheduled(cron = "0 0 1 * * *")
    public void fetchCoronaVirusData() throws IOException{
        Analyze.allCoronaVirusData=Analyze.getAllCoronaVirusData();
        System.out.println("更新数据");
    }
}
